/* -----------------------------------------------------------------------
   See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
   ----------------------------------------------------------------------- */
#include "plm_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "drr_opts.h"
#include "math_util.h"
#define OPENCL_FOUND 0

#ifndef NULL
#define NULL ((void*)0)
#endif



void
drr_opts_init (Drr_options* options)
{
    options->threading = THREADING_CUDA;
    options->image_resolution[0] = 448;//128;
    options->image_resolution[1] = 384;//128;
    options->image_size[0] = 400.0/512.0*448;//600;
    options->image_size[1] = 300;//600;
    options->isocenter[0] = 0.0f;
    options->isocenter[1] = 0.0f;
    options->isocenter[2] = 0.0f;
    options->have_image_center = 0;
    options->have_image_window = 0;
    options->have_angle_diff = 0;
    options->num_angles = 1;
    options->angle_diff = 1.0f;
	/*options->image_window[0]=0;
	options->image_window[1]=383;
	options->image_window[2]=0;
	options->image_window[3]=447;*/

    options->have_nrm = 0;
    options->nrm[0] = 1.0f;
    options->nrm[1] = 0.0f;
    options->nrm[2] = 0.0f;
    options->vup[0] = 0.0f;
    options->vup[1] = 0.0f;
    options->vup[2] = 1.0f;

    options->sad = 1000.0f;
    //options->sid = 1630.0f;
	options->sid = 1500.0f;
	//options->image_center[0]=0;
	//options->image_center[1]=192;
    options->scale = 1.0f;
    options->input_file = 0;
    options->output_prefix = "drr\\out_";
    options->exponential_mapping = 0;
    options->output_format= OUTPUT_FORMAT_RAW;
    options->multispectral = 0;
    options->algorithm = DRR_ALGORITHM_EXACT;
    options->geometry_only = 0;

}

void
set_image_parms (Drr_options* options)
{
	if (!options->have_image_center) {
		options->image_center[0] = (options->image_resolution[0]-1)/2.0;
		options->image_center[1] = (options->image_resolution[1]-1)/2.0;
	}
	if (!options->have_image_window) {
		options->image_window[0] = 0;
		options->image_window[1] = options->image_resolution[1] - 1;
		options->image_window[2] = 0;
		options->image_window[3] = options->image_resolution[0] - 1;
	}
	if (options->have_angle_diff) {
		options->angle_diff *= (float) (M_TWOPI / 360.0);
	} else {
		options->angle_diff = M_TWOPI / options->num_angles;
	}
}

